<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>提交订单</title>
    <link rel="stylesheet" href="__STATIC_URL__/static/mobile/css/weui.css" />
</head>
<style type="text/css">

    body{
        background: #F8F8F8;
    }
    .weui-media-box_appmsg .weui-media-box__hd{
        width:80px;
        height: 80px;
    }
    .weui-navba {
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        position: fixed;
        z-index: 500;
        bottom: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0px -3px 3px #eee;
        text-align:center;

    }
    button.weui-btn, input.weui-btn {
        width: 80%;
        border-width: 0;
        outline: 0;
        -webkit-appearance: none;
        margin: 10px auto;
    }
    img{
        max-width: 100%;
    }
</style>
<body>
<div class="container" id="container">
    <div class="weui-panel weui-panel_access">
        <div class="weui-panel__bd">
            <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                <div class="weui-media-box__hd">
                    <img class="weui-media-box__thumb" src="{$goods.img_url}" alt="">
                </div>
                <div class="weui-media-box__bd">
                    <p >商品名称：{$goods.goods_name}</p>
                    <p class="jifen" style="font-size: 14px;color: #999;">积分:<span style="color: #e4393c;">{$goods.goods_price}</span></p>
                    <p style="color: #999;font-size: 12px;">库存：{$goods.stock}</p>
                </div>
            </a>
        </div>
    </div>
    <div class="weui-panel" style="margin-top: 10px;">
        <div class="weui-panel__hd">商品描述：</div>
        <div class="weui-panel__bd">
            <div class="weui-media-box weui-media-box_text">
                <h4 class="weui-media-box__title">{$goods.goods_name}</h4>
                <div class="weui-media-box">{$goods.show}</div>
                <ul class="weui-media-box__info">
                    <li class="weui-media-box__info__meta">兑换时间：{$goods.begin_time|date="Y-m-d",###}至{$goods.end_time|date="Y-m-d",###}</li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="weui-cells weui-cells_form">
    <form method="post" action="" >
        <input type="hidden" name="card_id" value="{$user.card_id}">
        <input type="hidden" name="code" value="{$user.code}">
        <input type="hidden" name="name" value="{$goods.goods_name}">
        <input type="hidden" name="openid" value="{$user.openid}">
        <input type="hidden" name="uid" value="{$user.id}">
        <input type="hidden" name="mid" value="{$user.mid}">
        <input type="hidden" name="number" value="1">
        <input type="hidden" name="gid" value="{$goods.id}">
        <input type="hidden" name="goods_price" value="{$goods.goods_price}">


        <div class="weui-navba">
            <!--是否过期-->
            {gt name="goods.end_time" value=":time()"}
            <!--是否库存-->
            {lt name="goods.stock" value="1"}
            <button class="weui-btn  weui-btn_plain-disabled" type="button">没有库存</button>
            {else/}
            <!--商品类别-->
            {eq name="goods.goods_type" value="card_dis"}
            <!--卡券是否过期-->
            {eq name=":filteroffcard($goods['goods_card_id'])" value="true"}
            <!--是否已达到最高领取限制-->
            {if condition="getcardgetsume($goods['goods_card_id']) == getcardgetuser($goods['goods_card_id'],$user['openid'])" }
            <button class="weui-btn  weui-btn_plain-disabled"  type="button">已达到最高领取上限</button>
            {else/}
            <button class="weui-btn weui-btn_primary" type="submit" value="提交">立即兑换</button>
            {/if}
            {else/}
            <button class="weui-btn  weui-btn_plain-disabled"  type="button">该卡券已过期</button>
            {/eq}
            {/eq}
            <!--是否红包-->
            {eq name="goods.goods_type" value="red_money"}
            <button class="weui-btn  weui-btn_plain-disabled"  type="button">暂未开放</button>
            {/eq}
            {/lt}
            {else/}
            <!--停止兑换-->
            <button class="weui-btn weui-btn_primary weui-btn_plain-disabled"  type="button">已停止兑换</button>
            {/gt}
        </div>
    </form>
</div>


</div>
</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script type="text/javascript">
    wx.config({$share.wxjssdk});
    wx.ready(function(){
        wx.hideAllNonBaseMenuItem();

        // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中。
    });
</script>
</html>
